package cn.changeforyou.web.blog.controller;

/**
 * @author zhyu
 * @date 2021/3/9 15:10
 */

import cn.changeforyou.web.blog.po.Comment;
import cn.changeforyou.web.blog.service.CommentService;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.GET;
import org.nutz.mvc.annotation.Ok;

@IocBean
@At("/comment")
@Ok("json:full")
public class CommentController {

    @Inject
    private CommentService commentService;

    /**
     * 获取单篇文章
     */
    @At("/?")
    @GET
    public NutMap getById(int id) {
        Comment comment = commentService.getById(id);
        return new NutMap("status", 0).setv("data", comment);
    }
}
